//@author a0099566h
package testcases;

import static org.junit.Assert.assertEquals;
import logic.ScheduleAdder;

import org.junit.Test;

import storage.Storage;

public class ScheduleAdderTest {
	private final static String SAMPLE_FLOATING_TO_TEST_1 = "this is the description of the test";
	private final static String SAMPLE_FLOATING_TO_TEST_2 = "Lar dee dar";
	private final static String SAMPLE_DEADLINE_TO_TEST_1 = "this is the description for a deadline task on 20122014";
	private final static String SAMPLE_DEADLINE_TO_TEST_2 = "this is the description for a deadline task 2 on tomorrow";
	private final static String SAMPLE_TIMED_TO_TEST_1 = "abnn on monday from 1234 to 1432";
	private final static String SAMPLE_TIMED_TO_TEST_2 = "abnnc on 22 april from 1234 to 1432";
	private final static String SAMPLE_ERROR_TO_TEST_1 = "abcde from 2000 to 2359";
	private final static String SAMPLE_ERROR_TO_TEST_2 = "acd monday";
	
	
	private final static String SUCCESSFUL_FLOATING_MESSAGE_1 = "The event \"this is the description of the test\" has been added successfully to your Schedule!";
	private final static String SUCCESSFUL_FLOATING_MESSAGE_2 = "The event \"Lar dee dar\" has been added successfully to your Schedule!";
	private final static String SUCCESSFUL_DEADLINE_MESSAGE_1 = "The event \"this is the description for a deadline task\" has been added successfully to your Schedule!";
	private final static String SUCCESSFUL_DEADLINE_MESSAGE_2 = "The event \"this is the description for a deadline task 2\" has been added successfully to your Schedule!";
	private final static String SUCCESSFUL_TIMED_MESSAGE_1 = "The event \"abnn\" has been added successfully to your Schedule!";
	private final static String SUCCESSFUL_TIMED_MESSAGE_2 = "The event \"abnnc\" has been added successfully to your Schedule!";
	private final static String UNSUCCESSFUL_MESSAGE="Invalid Input String! Please Re-try!";
	private Storage testList = new Storage("addertest1.txt");
	private ScheduleAdder testAdder = new ScheduleAdder(testList);

	@Test
	public void test() {
		testList.clearAllEvents();
		assertEquals("This message comes out if the junit is wrong.", SUCCESSFUL_FLOATING_MESSAGE_1, testAdder.addEvent(SAMPLE_FLOATING_TO_TEST_1,null));
		assertEquals("This message comes out if the junit is wrong.", SUCCESSFUL_FLOATING_MESSAGE_2, testAdder.addEvent(SAMPLE_FLOATING_TO_TEST_2,null));
		assertEquals("This message comes out if the junit is wrong.", SUCCESSFUL_DEADLINE_MESSAGE_1, testAdder.addEvent(SAMPLE_DEADLINE_TO_TEST_1,null));
		assertEquals("This message comes out if the junit is wrong.", SUCCESSFUL_DEADLINE_MESSAGE_2, testAdder.addEvent(SAMPLE_DEADLINE_TO_TEST_2,null));
		assertEquals("This message comes out if the junit is wrong.", SUCCESSFUL_TIMED_MESSAGE_1, testAdder.addEvent(SAMPLE_TIMED_TO_TEST_1,null));
		assertEquals("This message comes out if the junit is wrong.", SUCCESSFUL_TIMED_MESSAGE_2, testAdder.addEvent(SAMPLE_TIMED_TO_TEST_2,null));
		assertEquals("This message comes out if the junit is wrong.", UNSUCCESSFUL_MESSAGE, testAdder.addEvent(SAMPLE_ERROR_TO_TEST_1,null));
		assertEquals("This message comes out if the junit is wrong.", UNSUCCESSFUL_MESSAGE, testAdder.addEvent(SAMPLE_ERROR_TO_TEST_2,null));
	}

}
